function post(url,data,callback){
    var ajax = new XMLHttpRequest();

    ajax.onreadystatechange = ()=>{
        if(ajax.readyState == 4 && ajax.status ==200){
            // checkMsg.innerText = ajax.responseText;
            var json = ajax.responseText;
            var result = JSON.parse(json);
            callback(result);
        }
    }

    ajax.open("post",url);
    //设置提交数据的内容类型
    if (data instanceof String){
        //表单提交参数
        ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
    }else if (data instanceof  FormData){
        //文件上传
        ajax.setRequestHeader("Content-Type","multipart/form-data")
    }
    ajax.send(data);

}


function get(url,callback){
    var ajax = new XMLHttpRequest();

    ajax.onreadystatechange = ()=>{
        if(ajax.readyState == 4 && ajax.status ==200){
            var json = ajax.responseText;
            var result = JSON.parse(json);
            callback(result);
        }
    }

    ajax.open("get",url);
    ajax.send(null);

}



